<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
 <meta charset="utf-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>基本热力图</title>
 <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
 <style>
  input[type="text"] {
   height: 25px;
   outline: none;
   border: 0;
   border: 1px solid #CCCCCC;
   padding: 0 4px;
  }

  .amap-logo,.amap-copyright{
   display: none!important;
  }
 </style>
</head>
<body>
<div id="container" class="container"></div>
<script src="http://webapi.amap.com/loca?key=e33934b077cf6457665ff67cf5295c61"></script>
<script src="http://a.amap.com/Loca/static/mock/heatmapData.js"></script>
<script>

    var map = Loca.create('container', {
        features: ['bg', 'road'],
        center: [116.397475, 39.908668],
        zoom: 10
    });

    var layer = Loca.visualLayer({
        container: map,
        type: 'heatmap',
        shape: 'normal'
    });

    var list = [];
    var i = -1, length = heatmapData.length;
    while (++i < length) {
        var item = heatmapData[i];
        list.push({
            coordinate: [item.lng, item.lat],
            count: item.count
        })
    }

    layer.setData(list, {
        lnglat: 'coordinate',
        value: 'count'
    });

    layer.setOptions({
        style: {
            radius: 25,
            opacity: [0, 0.7],
        },
        gradient: {
            0.5: 'blue',
            0.65: 'rgb(117,211,248)',
            0.7: 'rgb(0, 255, 0)',
            0.9: '#ffea00',
            1.0: 'red'
        }
    });

    layer.render();

</script>
</body>
</html>